import service from "@/utils/request";
import { de } from "element-plus/es/locale";
import { Ridgepole } from "./model";
const DEPT_BASE_URL = "/api/";
class vendor {
  //羊场列表
  static getSheepFacroryList(queryParams?: organQuery) {
    return service<any, organQuery>({
      url: `${DEPT_BASE_URL}Sheep/SheepList`,
      method: "post",
      data: queryParams,
    });
  }
  //删除羊场
  static DeleteSheepFactory(sheepId: number[]) {
    return service<any, any>({
      url: `${DEPT_BASE_URL}Sheep/DeleteSheep`,
      method: "post",
      data: sheepId,
    });
  }
  //添加羊场
  static AddSheep(data: AddSheepFactory) {
    return service({
      url: `${DEPT_BASE_URL}Sheep/AddSheep`,
      method: "post",
      data: data,
    });
  }

  static SheepType() {
    return service({
      url: `${DEPT_BASE_URL}Sheep/GetDepartMent`,
      method: "get",
    });
  }

  //羊场反填
  static Fan(sheepId: number) {
    return service<any, any>({
      url: `${DEPT_BASE_URL}Sheep/GetSheep`,
      method: "post",
      data: sheepId,
    });
  }

  //羊场修改
  static UpdateSheep(data: AddSheepFactory) {
    return service({
      url: `${DEPT_BASE_URL}Sheep/UpdateSheep`,
      method: "post",
      data: data,
    });
  }

  //栋舍显示功能
  static getList(RidegShows?: Ridgepole) {
    return service<any, Ridgepole>({
      url: `${DEPT_BASE_URL}Ridgepoles/GetShow`,
      method: "get",
      params: RidegShows,
    });
  }
  //栋舍逻辑删除
  static deleteridgepoles(id: number) {
    return service({
      url: `${DEPT_BASE_URL}Ridgepoles/Delete`,
      method: "delete",
      data: {
        id: id,
      },
    });
  }
  //栋舍批量逻辑删除
  static DeleteRan(ids: any) {
    return service({
      url: `${DEPT_BASE_URL}Ridgepoles/DeleteRange`, // 使用一个专门的接口来支持批量删除
      method: "put",
      data: {
        ids: ids, // 将要删除的ID列表发送到后端
      },
    });
  }
  //栋舍类型
  static GetShowbreed() {
    return service({
      url: `${DEPT_BASE_URL}Ridgepoles/ShowRidogepolesBreed`,
      method: "get",
    });
  }

  //栋舍类型
  static GetShowPeople() {
    return service({
      url: `${DEPT_BASE_URL}Ridgepoles/ShowPeopleBreed`,
      method: "get",
    });
  }

  //栋舍添加
  static AddRan(data?: RidgepoleAdd) {
    return service({
      url: `${DEPT_BASE_URL}Ridgepoles/AddManager`,
      method: "post",
      data: data,
    });
  }
  //栋舍反填
  static Finds(id: number) {
    return service({
      url: `${DEPT_BASE_URL}Ridgepoles/GetFind`,
      method: "get",
      params: {
        id: id,
      },
    });
  }
  //栋舍修改
  static Updates(data?: RidgepoleAdd) {
    return service({
      url: `${DEPT_BASE_URL}Ridgepoles/UpdateManger`,
      method: "post",
      data: data,
    });
  }

  //栏位显示
  static GetColumnShow(id: number) {
    return service({
      url: `${DEPT_BASE_URL}ColumnManages/GetColumn`,
      method: "get",
      params: {
        ridgepoleId: id,
      },
    });
  }

  //栋舍添加
  static AddinfosCol(data?: AddColumn) {

    return service({
      url: `${DEPT_BASE_URL}ColumnManages/AddManager`,
      method: "post",
      data: data,
    });
  }

  // static AddRid(Ridgepole?: RidgepoleAdd) {
  //   return service({
  //     url: `${DEPT_BASE_URL}Ridgepoles/AddManager`,
  //     method: "post",
  //     data: Ridgepole,
  //   });
  // }

  //栏位显示
  static getColumn(data?: Columns) {
    return service<any, Columns>({
      url: `${DEPT_BASE_URL}ColumnManages/GetShow`,
      method: "post",
      data: data,
    });
  }
}

export default vendor;

export interface AddColumn {
  columnName: string;
  prefix: string;
  startingNumbering: number;
  columnCount: number;
  ridgepoleId: number;
  ridgepoleTypeId: number;
  responsiblePerson: string;
}

export interface RidgepoleAdd {
  ridgepoleId: number;
  ridgepoleTypeId: number;
  ridgepoleName: string;
  responsiblePerson: string;
  productionPersonnel: string;
  state: number;
  remark: string;
  createName: string;
  createTime: Date;
  updateName: string;
  updateTime: Date;
  sheepId: number;
}

export interface Rideg {
  pageIndex: number;
  pageSize: number;
  sheepId: number;
  sheepFullName: string;
  responsiblePerson: string;
}

export interface organQuery {
  pageIndex: number;
  pageSize: number;
  sheepId: number;
  sheepFullName: string;
  responsiblePerson: string;
}

export interface AddSheepFactory {
  sheepId: number;
  sheepFullName: string;
  sheepAbbreviation: string;
  sheepScale: string;
  sheepAddr: string;
  address: string;
  responsiblePerson: string;
  departId: number;
  state: number;
  isdelete: 0;
}
